package dao.proxy.comm;

import dao.comm.IUserDAO;
import dao.impl.comm.UserDAOImpl;
import dbc.comm.DatabaseConnection;
import vo.comm.User;

public class UserDAOProxy implements IUserDAO{
	private DatabaseConnection dbc=null;
	private IUserDAO dao=null;
	public UserDAOProxy() throws Exception{
		this.dbc=new DatabaseConnection();
		this.dao=new UserDAOImpl(this.dbc.getConnection());
	}
	public boolean doRegister(User user) throws Exception{
		boolean flag=false;
		if(this.dao.findById(user.getUserid())==null){
			flag=this.dao.doRegister(user);
		}
		this.dbc.close();
		return flag;
	}
	public boolean findLogin(User user) throws Exception{
		boolean flag=false;
		flag=this.dao.findLogin(user);
		this.dbc.close();
		return flag;
	}
	public User findById(String userid) throws Exception{
		User user=null;
		user=this.dao.findById(userid);
		this.dbc.close();
		return user;
	}
}
